package everydayGrade.t6;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: Siantar
 * @Date: 2023-10-19-15:01
 * @Description: 1.0
 */
public class T1726 {
    public int tupleSameProduct(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        int n = nums.length, res = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int sum = nums[i] + nums[j];
                int pre = map.getOrDefault(sum, 0);
                res += pre;
                map.put(sum, pre + 1);
                System.out.println(sum);
            }
        }
        return res;
    }
}
